﻿//-----------------------------------------------------------------------
// <copyright file="Document.cs" company="tuliprules.org">
//     Copyright (c) 2011 tuplelister, tuliprules.org.
// </copyright>
// <summary>This is the Document class.</summary>
//-----------------------------------------------------------------------
namespace Tulip.Rules.Models.Rif.Core
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Xml.Serialization;

    /// <summary>
    /// Represents a document containing optional directive and payload roles.
    /// </summary>
    [Serializable]
    [DesignerCategory(@"code")]
    [XmlType(AnonymousType = true, Namespace = "http://www.w3.org/2007/rif#")]
    [XmlRoot(Namespace = "http://www.w3.org/2007/rif#", IsNullable = false)]
    public class Document : Irimeta, IRifCoreElement
    {
        /// <summary>
        /// The directive field.
        /// </summary>
        [EditorBrowsable(EditorBrowsableState.Never)]
        private List<Directive> directiveField;

        /// <summary>
        /// The payload field.
        /// </summary>
        [EditorBrowsable(EditorBrowsableState.Never)]
        private Payload payloadField;

        /// <summary>
        /// Initializes a new instance of the Document class.
        /// </summary>
        public Document()
        {
            this.directiveField = new List<Directive>();
        }

        /// <summary>
        /// Gets or sets a list of directive roles, each containing Import.
        /// </summary>
        [XmlElement("directive", Order = 0)]
        public List<Directive> Directives
        {
            get
            {
                return this.directiveField;
            }

            set
            {
                this.directiveField = value;
            }
        }

        /// <summary>
        /// Gets or sets a payload role, containing Group.
        /// </summary>
        [XmlElement("payload", Order = 1)]
        public Payload Payload
        {
            get
            {
                return this.payloadField;
            }

            set
            {
                this.payloadField = value;
            }
        }
    }
}
